Skip to content

Ignore review markers posted by non-bot accounts - #487

Open
gautamrn wants to merge 2 commits into
google:mainfrom
gautamrn:trust-only-bot-review-markers
Open

gautamrn wants to merge 2 commits into
google:mainfrom
gautamrn:trust-only-bot-review-markers

Conversation

@gautamrn

@gautamrn gautamrn commented Nov 19, 2026 •

Copy link
Copy Markdown

Summary of Key Changes

EECS 481 (University of Michigan) student contribution.

The triage bot skips a PR head when it finds its SHA marker
(<!-- egm-triage-review:sha=<head> -->) in a review or comment, but it never
checked who posted the marker. A PR author or any commenter could paste the
marker and suppress the automated review, the triage: passed label, and
maintainer routing for that head. Copying a bot comment's raw Markdown had the same effect.

  • review_pr.py: evaluate_sweep_gate only honors markers from bot actors
    (_is_bot_actor, which already covers egm-triage-bot and [bot] accounts).
    The trusted-human check is unchanged.
  • pr-triage-review.yml: the duplicate-post guard only honors markers in
    reviews from Bot-type users or egm-triage-bot (the PAT and the
    GITHUB_TOKEN fallback identities).
  • Tests: human-posted markers in a review and an issue comment no longer skip
    the gate; a human review marker no longer suppresses posting. The existing
    duplicate-post test now uses a bot-authored review.

Contribution Type

Track: Bug Fix / Minor Patch

Verification

  • New Python and JS regression cases fail without the fix and pass with it.
  • pytest tests/unit (Windows 11, Python 3.13.2, Node 22.12.0): all pass except
    the 16 symlink tests that need Developer Mode, which fail identically on main.
  • ruff check .: passed. git diff --check: passed.
  • actionlint: not run locally.
  • Confirmed on PR Align AGENTS.md track names with the PR template #482 that the bot posts as egm-triage-bot (type User),
    which is in BOT_AUTHORS.

Human Accountability Affirmation

@gautamrn
gautamrn requested a review from a team as a code owner November 19, 2026 06:22
@gautamrn
gautamrn requested a review from seanstappas November 19, 2026 06:22

@egm-triage-bot egm-triage-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated first-pass review found zero blocking or major issues. Routing to @google/egm-maintainers for maintainer review.

@egm-triage-bot egm-triage-bot added the triage: passed Automated Stage-1 PR triage found zero blocking or major issues label Nov 19, 2026
seanstappas
seanstappas previously approved these changes Nov 20, 2026

@seanstappas seanstappas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. The actor guards in .github/scripts/review_pr.py and .github/workflows/pr-triage-review.yml ignore non-bot SHA markers while keeping dedup working for egm-triage-bot and github-actions[bot]. I left three optional, non-blocking suggestions covering bot allowlist scope and two extra test branches. Ready to merge once the Tests workflow is approved and green.

Comment thread .github/workflows/pr-triage-review.yml Resolved
Comment thread tests/pr_triage_post.cjs
const state = createHarness({
existingReviews: [{ body: '<!-- egm-triage-review:sha=abc12345 -->\nClean pass.' }],
existingReviews: [{
user: { login: 'egm-triage-bot', type: 'User' },

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking suggestion: updating this case to egm-triage-bot leaves the type === "Bot" arm untested. Adding cases for github-actions[bot] (type: 'Bot') and a deleted reviewer (user: null) would exercise the full isBot check.

@gautamrn gautamrn Nov 20, 2026 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added tests for github-actions[bot] (type[bot]) and a deleted reviewer (user: null) in the latest commit

assert not same_sha.should_review
assert same_sha.reason == "SKIP_SHA_ALREADY_REVIEWED:deadbeef"

spoofed = {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking suggestion: same_sha above only covers github-actions[bot] in reviews. Adding a SKIP_SHA_ALREADY_REVIEWED check for egm-triage-bot (type: "User", author_association: "MEMBER") and a bot-authored marker in issue_comments would pin the primary paths too.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added cases for an egm-triage-bot marker (type User, MEMBER) in both reviews and issue comments.

@gautamrn

Copy link
Copy Markdown
Author

@seanstappas
The Windows unit job failed on a 10-second timeout in test_ci_workflow.py, which also failed the same way on main (run 44789423212). Could a maintainer rerun it?

@n3wth

n3wth commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator

@gautamrn, Current CI is green. Could a maintainer review the marker provenance check before we change reviewer routing in #444?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage: passed Automated Stage-1 PR triage found zero blocking or major issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants